package com.lineage.server.datatables.lock;

import com.lineage.server.datatables.sql.EzpayTable1;
import com.lineage.server.datatables.storage.EzpayStorage1;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class EzpayReading1 {
  private final Lock _lock = new ReentrantLock(true);
  
  private final EzpayStorage1 _storage = (EzpayStorage1)new EzpayTable1();
  
  private static EzpayReading1 _instance;
  
  public static EzpayReading1 get() {
    if (_instance == null)
      _instance = new EzpayReading1(); 
    return _instance;
  }
  
  public Map<Integer, int[]> ezpayInfo(String loginName) {
    this._lock.lock();
    Map<Integer, int[]> tmp = null;
    try {
      tmp = this._storage.ezpayInfo(loginName);
    } finally {
      this._lock.unlock();
    } 
    return tmp;
  }
  
  public int[] ezpayInfo(String loginName, int id) {
    this._lock.lock();
    int[] tmp = null;
    try {
      tmp = this._storage.ezpayInfo(loginName, id);
    } finally {
      this._lock.unlock();
    } 
    return tmp;
  }
  
  public boolean update(String loginName, int id, String pcname, String ip, String clanName) {
    this._lock.lock();
    boolean tmp = false;
    try {
      tmp = this._storage.update(loginName, id, pcname, ip, clanName);
    } finally {
      this._lock.unlock();
    } 
    return tmp;
  }
}
